import javax.swing.JFrame;


public class Main extends JFrame{

    public static final int WIDTH= 960; // + 8 + 3 = cinematic?
    public static final int HEIGHT = 600; // + 28 + 25 = cinematic?
    public static final int SCALE = 1;
    public static final int PARTICLECOUNT = 20000;
    public static final int TICK = 33;
		
	public static void main(String[] args) {

        
        JFrame frame = new JFrame("ParticleMaker");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(WIDTH, HEIGHT);
        frame.setUndecorated(false);
        frame.setResizable(true);
        frame.setFocusable(true);
        
        final RenderClass6_5 ren = new RenderClass6_5(WIDTH, HEIGHT);
        ren.spawnParticles(50);
        
        frame.add(ren);
        
        frame.setVisible(true); // NEEDS TO BE AFTER ADDING ALL OBJECTS TO FRAME
        
        final boolean stop = false; // final and yet needs to not be final to be useful
        
        Thread runThread = new Thread(new Runnable(){
            public void run(){
              if(stop != true){
                  for(int i = 0; i < 0x7fffffff; i++){ //not infinite, stops after 1000000 repaint()'s
                      ren.repaint( );
                      try{Thread.sleep(TICK);}catch(Exception e){System.out.println("Exception e at Thread.sleep");}
                  }
              }
          }
        });
        
        runThread.start();
	}

}
